const util = require('../../../utils/util.js')
const app = getApp()
const WxParse = require('../../../public/wxParse/wxParse.js')

Page({

  /**
   * 页面的初始数据
   */
  data: {
    articleInfo: {},
    article_description: ""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let id = options.id
    this.setData({
      id: id
    })
    app.initPage().then(res => {
      this.articleGet()
    });
  },

  articleGet() {
    app.api.articleGet(this.data.id).then(res => {
      let articleInfo = res.data
      this.setData({
        articleInfo: articleInfo
      })
      //html转wxml
      WxParse.wxParse('description', 'html', articleInfo.articleContent, this, 0)
    });
  },
})